When Not to Use Divide-and-Conquer(분할정복법 사용을 피해야 하는 경우)

If possible, we should avoid divide-and-conquer in the following two cases:

  • An instance of size n is divided into or more instances each almost of size n.

// n th Fibonacci Term (Recursive)
fib(n) = fib(n-1) + fib(n-2) // n < 2n-3

크기 n인 문제가 분할과정에서 거의 각각 n 크기의 문제로 분할되는 경우

피보나찌 수열을 예로 들면, fib(n)을 구하기 위해 문제를 fib(n-1)과 fib(n-2)로 분할했지만 그렇게 함으로써 문제의 크기는 처음 가지고 있던 것보다 더 커지게 된다. (n < 2n-3)

  • An instance of size n is divided into almost n instances of size n/c, where c is a constant.

크기 n인 문제가 n/c(c는 상수)의 크기로 거의 n개로 분할되는 경우


The first partitioning leads to an exponential-time algorithm, where the second leads to a n^Θ(logn) algorithm.

첫번째 경우는 exponential-time 알고리즘으로 이어지고, 두번째는 n^Θ(logn) 알고리즘의 결과를 초래한다.

결론적으로 상기 두 가지 경우처럼 분할했을 때의 크기가 처음 가지고 있던 문제의 크기 보다 커지거나 혹은 비슷하다면 분할정복법 사용을 지양해야 한다.

Share